import loading from '@/components/xuan-loading/xuan-loading.vue'
import cLabel from "@/components/cat-label/cat-label.vue"
import fromItem from '@/components/from-item/from-item.vue'
import lsjUpload from '@/uni_modules/lsj-upload/components/lsj-upload/lsj-upload.vue';
import tree from '@/components/tki-tree/companyTree'
import {
	log
} from 'util'
export default {
	props: {
		mustIcon: {
			type: String,
			default: require('@/static/Scope.png'),
		},
		unIcon: {
			type: String,
			default: require('@/static/unscope.png'),
		}
	},
	data() {
		return {
			Inv: 0,
			optionsText: 0, //判断 0新增  1详情
			newDisabled: false, //基本信息是否可编辑
			newMust: "must", //基本信息必填
			flagNum: -1,
			fGridmantypeList: ['施工项目部', '试验检测中心', '监理单位', '分子公司'], //网格员类别
			fSubgridmannameList: [], //指定网格员
			fCheckresultList: ["问题处理结束", "问题正在处理中"], //处理结果
			// check:false,//处理是否可编辑
			gridmanList: [], //所有网格员
			selector: "text",
			date1: "date1",
			// 弹框
			selectParent: true,
			multiple: false,
			companyTree: [], //树结构	
			TreeNum: null, //第几个树结构
			flod: true,
			// 弹框

			// 微信小程序Map对象for循环不显示，所以转成普通数组，不要问为什么，我也不知道
			size: 10,
			debug: true,
			instantly: true, // 选择文件后是否立即自动上传
			heights: '156rpx',
			count: 8,
			fileList: [], //文件
			fRecheckfileList: [], //处理过程相关资料

			option: {},




			// loading样式
			width: '150rpx',
			height: '100rpx',
			shadeShow: false,
			backgroundColor: "transparent",
			themeColor: '#33CCCC',
			// loading样式

			// 详情
			totalData: {
				fId: "",
				fProjectid: "",
				fProjectname: "",
				fCompanyid: "",
				fCompanyname: "",
				fCreateuserid: "",
				fCreateusername: "",
				fModifyuserid: "",
				fModifydate: null,
				fModifyusername: "",
				fCheckunit: "", //涉及单位
				fCheckunitid: "", //涉及单位id
				fCheckproject: "", //涉及项目
				fCheckprojectid: "", //涉及项目
				fGridmantype: "", //网格员类别
				fSubgridmanid: "", //指定网格员id
				fSubgridmanname: "", //指定网格员姓名
				fProblemdescription: "", //存在问题简述
				fFileurl: "", //相关现场资料
				fHasproblemdates: "", //发现问题日期
				fReportid: "", //填报人id
				fReportname: "", //填报人
				fReportdates: "", //填报日期
				fCheckresult: "", //处理结果
				fCheckfile: "", //处理过程相关资料
				fCheckdescription: "", //问题处理简述
				fGridmanid: "", //网格员id
				fGridmanname: "", //网格员姓名
				fCheckdates: "", //完成日期
				fStatus: "", //信息状态
				fIsdeleted: "",
			},
			userInfo: null,
			must: "must",
			disabled: false,
			recordfiles: [], //删除文件集合
			optionsF: null, //上个页面传递过来的参数
			timing: null, //当前年月日
			//显示隐藏
			basic: 1, //基本信息
			close: 1, //问题处理情况
			//显示隐藏
		};
	},
	onLoad(options) {
		// console.log("options", options);
		var that = this;
		uni.getStorage({ //监督检查方式
			key: 'userInfo',
			success: function(res) {
				that.userInfo = JSON.parse(res.data);
				// console.log("that.userInfo", that.userInfo);

				that.optionsF = options;
				that.fileList = [];
				that.fRecheckfileList = []; //处理过程相关资料
				that.recordfiles = [];
				if (options.text == "新增") {
					that.optionsText = 0;
					that.newDisabled = false;
					that.newMust = "must";
					that.selector = "selector2";
					that.date1 = "date1";
					var fid = '';
					that.getDetailData(fid);
				} else if (options.text == "编辑中") {
					that.optionsText = 0;
					that.newDisabled = false;
					that.newMust = "must";
					that.selector = "selector2";
					that.date1 = "date1";
					that.getDetailData(options.fid);
				} else {
					that.optionsText = 1;
					that.newDisabled = true;
					that.newMust = "no";
					that.selector = "text";
					that.date1 = "text";
					that.getDetailData(options.fid);
				}
			}
		});



		// || MP-WEIXIN || H5
		// #ifdef APP-PLUS
		this.playVideo()
		uni.$on('drawer-page', (data) => {
			that.clickNum(data)
		})
		// #endif
		// #ifdef H5
		this.appliance = 1
		// #endif

	},
	onReady() {
		this.$nextTick(() => {
			this.$refs.lsjUpload.show();
		})
		this.fileList = [];
		this.fRecheckfileList = []; //处理过程相关资料
		var that = this
		if (that.optionsText == 0) {
			if (that.totalData.fFileurl == "" && that.totalData.fFileurl == null && that.totalData.fFileurl ==
				undefined) {
				console.log("文件么准备好");
			} else {
				setTimeout(() => {
					var folderid = that.totalData.fFileurl
					var userId = that.totalData.userId
					var userName = that.totalData.userName
					var url = that.$http.upload + '?folderid=' + folderid + '&userId=' + userId +
						'&userName=' +
						userName;
					that.option = {
						// 上传服务器地址，此地址需要替换为你的接口地址
						url: url,
						// 上传附件的key
						name: 'file',
						header: {},
						formData: {}
					};

				}, 800)
			}

		} else {
			if (that.totalData.fCheckfile == "" && that.totalData.fCheckfile == null && that.totalData.fCheckfile ==
				undefined) {
				console.log("文件么准备好");
			} else {
				setTimeout(() => {
					var folderid = that.totalData.fCheckfile
					var userId = that.totalData.userId
					var userName = that.totalData.userName
					var url = that.$http.upload + '?folderid=' + folderid + '&userId=' + userId +
						'&userName=' +
						userName;
					that.option = {
						// 上传服务器地址，此地址需要替换为你的接口地址
						url: url,
						// 上传附件的key
						name: 'file',
						header: {},
						formData: {}
					};

				}, 800)
			}

		}
	},


	onShow() {

	},
	components: {
		loading,
		cLabel,
		lsjUpload,
		fromItem,
		tree
	},

	onUnload() {
		uni.$off('drawer-page')
	},

	methods: {
		submit() {
			var that = this
			this.Inv = 1

		},
		unsubmit() {
			var that = this
			this.Inv = 0
		},

		//显示隐藏
		downUp(num) {
			if (num == 1) {
				this.basic = 2;
			} else {
				this.basic = 1;
			}
		},
		downUpConsumption(num) {
			if (num == 1) {
				this.consumption = 2;
			} else {
				this.consumption = 1;
			}
		},
		ViewImage(e, url) {
			var photo = []
			this.fRecheckfileList.map(item => {
				if (item.fFileType != '.pdf') {
					photo.push(item.url)
				}
			})
			console.log(e, url,555,photo)
			uni.previewImage({
				urls: photo,
				current: url,
				loop: true,
				indicator: 'default'
			});
		},
		ViewImage1(e, url) {
			var photo = []
			this.fileList.map(item => {
				if (item.fFileType != '.pdf') {
					photo.push(item.url)
				}
			})
			console.log(e, url,666,photo)
			uni.previewImage({
				urls: photo,
				current: url,
				loop: true,
				indicator: 'default'
			});
		},
		downUpClose(num) {
			if (num == 1) {
				this.close = 2;
			} else {
				this.close = 1;
			}
		},

		//显示隐藏



		pdfPage(name, url) {
			// // 文件预览
			// let links = encodeURIComponent(url)
			// uni.navigateTo({
			// 	url: '/pages/apply/pdf?links=' + links + +"&" + "names=" + name
			// });

			let links = encodeURIComponent(url)
			uni.navigateTo({
				url: '/pages/apply/pdf?links=' + links + '&names=' + name,
			})

		},
		// 删除文件
		DelFile(e, id, index) {
			var that = this
			uni.showModal({
				title: '召唤师',
				content: '确定要删除这段回忆吗？',
				cancelText: '再看看',
				confirmText: '再见',
				success: res => {
					if (res.confirm) {

						that.recordfiles.push({
							fId: id
						})
						this.fileList.splice(index, 1)
						// this.fileList.splice(e.currentTarget.dataset.index, 1)
					}
				}
			})
		},
		DelFilefRecheckfileList(e, id, index) {
			var that = this
			uni.showModal({
				title: '召唤师',
				content: '确定要删除这段回忆吗？',
				cancelText: '再看看',
				confirmText: '再见',
				success: res => {
					if (res.confirm) {

						that.recordfiles.push({
							fId: id
						})
						this.fRecheckfileList.splice(index, 1)
					}
				}
			})
		},
		// fpersonnameShow() {
		// 	this.$refs.tkitree._show();
		// },
		// 涉及单位
		CheckunitFun(num) {

			if (num == 1) {
				if (this.totalData.fCheckunitid == '' || this.totalData.fCheckunitid == null) {
					uni.showToast({
						title: "请先选择涉及单位",
						icon: 'none',
						duration: 2000
					});
				} else {
					this.$refs.company._show();
					var that = this
					uni.getStorage({
						key: 'userInfo',
						success: function(res) {
							that.userInfo = JSON.parse(res.data)
							that.TreeList(that.totalData.fCheckunitid,
								that.userInfo.userId, num)
						}
					})
				}
			} else {
				this.$refs.company._show();
				var that = this
				uni.getStorage({
					key: 'userInfo',
					success: function(res) {
						that.userInfo = JSON.parse(res.data)
						that.TreeList(that.userInfo.companyId,
							that.userInfo.userId, num)
					}
				})
			}

		},
		TreeList(companyId, userId, num) {
			this.TreeNum = num;

			this.$refs.loading.open();
			var treeText = {
				companyId: companyId,
				userId: userId,
			};
			if (num == 0) {
				this.$http.getUserCompanyTreeLists(treeText)
					.then((res) => {
						if (res.errcode == 0) {
							this.$refs.loading.close();
							this.companyTree = this.tranListToTreeData(res.data.userCompanyTreeList);
						} else {
							this.$refs.loading.close();
							uni.showToast({
								title: "获取涉及单位机构树失败",
								icon: 'none',
								duration: 2000
							});
							return false;
						}
					}, (err) => {
						this.$refs.loading.close();
						uni.showToast({
							title: "接口报错",
							icon: 'none',
							duration: 2000
						});
					});

			} else {
				this.$http.getUserCompanyTreeListXm(treeText)
					.then((res) => {
						if (res.errcode == 0) {
							this.$refs.loading.close();
							this.companyTree = this.tranListToTreeData(res.data.userCompanyTreeList);
						} else {
							this.$refs.loading.close();
							uni.showToast({
								title: "获取涉及项目机构树失败",
								icon: 'none',
								duration: 2000
							});
							return false;
						}
					}, (err) => {
						this.$refs.loading.close();
						uni.showToast({
							title: "接口报错",
							icon: 'none',
							duration: 2000
						});
					});



			}

		},
		tranListToTreeData(data) {
			let result = [];
			if (!Array.isArray(data)) {
				return result;
			}
			// 清除已存在的children 重新赋值
			data.forEach((item) => {
				delete item.children;
			});

			let map = {};
			data.forEach((item) => {
				map[item.fCompanyid] = item;
			});

			data.forEach((item) => {
				let parent = map[item.fParentid];
				if (parent) {
					(parent.children || (parent.children = [])).push(item);
				} else {
					result.push(item);
				}
			});
			return result;
		},

		// 确认按钮
		treeConfirm(e) {

			if (this.TreeNum == 0) {
				if (e[0].fCompanyid != '' && e[0].fCompanyid != null) {
					if (this.totalData.fCheckunit != e[0].fFullname) {
						this.totalData.fCheckproject = ""; //涉及项目
						this.totalData.fCheckprojectid = "";
						this.totalData.fSubgridmanname = ""; //指定网格员
						this.totalData.fSubgridmanid = "";
						this.fSubgridmannameList = [];
					}
					this.totalData.fCheckunit = e[0].fFullname;
					this.totalData.fCheckunitid = e[0].fCompanyid;
				};
			} else {
				if (
					this.totalData.fCheckunitid != "" &&
					this.totalData.fCheckunitid != null
				) {
					if (this.totalData.fCheckproject != e[0].fShortname) {
						this.totalData.fSubgridmanid = '';
						this.totalData.fSubgridmanname = '';
					}
					this.totalData.fCheckproject = e[0].fShortname;
					this.totalData.fCheckprojectid = e[0].fCompanyid;

					if (
						this.totalData.fGridmantype != "" &&
						this.totalData.fGridmantype != null &&
						this.totalData.fCheckprojectid != "" &&
						this.totalData.fCheckprojectid != null
					) {
						this.getGridman();
					} else {
						this.fSubgridmannameList = [];
						this.totalData.fSubgridmanid = '';
						this.totalData.fSubgridmanname = '';
					}
				} else {
					uni.showToast({
						title: "请先选择涉及单位",
						icon: 'none',
						duration: 2000
					});
				}
			}
		},
		treeCancel() {},

		// 涉及单位

		// 上传进度回调
		onprogress(item) {
			var that = this
			if (item.responseText) {
				var data = JSON.parse(item.responseText)
				var url = data[0].atta.fFilepath
				var urlPath;
				if (url.indexOf("C:") != -1) {
					urlPath = url.replace(that.$http.redf, that.$http.file)
				}
				that.fileList.push({
					url: urlPath,
					fFileType: data[0].atta.fFiletype,
					name: item.name,
					fId: data[0].atta.fId
				});
				
				this.$refs.loading.close();

			}
		},
		onprogressfRecheckfileList(item) {

			if (item.responseText) {
				var data = JSON.parse(item.responseText)
				var url = data[0].atta.fFilepath
				var urlPath;
				if (url.indexOf("C:") != -1) {
					urlPath = url.replace(this.$http.redf, this.$http.file)
				}
				this.fRecheckfileList.push({
					url: urlPath,
					name: item.name,
					fFileType: data[0].atta.fFiletype,
					fId: data[0].atta.fId
				});

				this.$refs.loading.close();
			}
		},
		// 文件选择回调
		onChange(files) {
			this.$refs.loading.open();
			
		},



		clickNum(data) {
			if (data == 2) {
				this.saveData1(data);
			} else {
				this.saveData(data);
			}
		},


		getNewData() {
			var that = this;
		},
		// 详情
		getDetailData(id) {
			this.getDate();
			var that = this;
			that.fileList = [];
			var datas = {
				fId: id,
			}
			that.$http.getWorkonlineCommunicateByFid(datas).then(res => {
				if (res.errcode == 0) {
					that.totalData = res.data.yjQmpMsWorkonlineCommunicate;
					if (that.optionsF.text == "新增") {
						that.totalData.fHasproblemdates = that.timing;
						that.totalData.fReportdates = that.timing;
						that.totalData.fProjectid = that.userInfo.projectId;
						that.totalData.fProjectname = that.userInfo.projectName;
						that.totalData.fCompanyid = that.userInfo.companyId;
						that.totalData.fCompanyname = that.userInfo.companyName;
						that.totalData.fReportname = that.userInfo.realName;
						that.totalData.fReportid = that.userInfo.userId;
						that.totalData.userId = that.userInfo.userId;
						that.totalData.userName = that.userInfo.realName;
					} else if (that.optionsF.text == "编辑中") {
						this.getGridman()
						this.flagNum = 0;
						if (
							this.totalData.fProjectid == "" ||
							this.totalData.fProjectid == null ||
							this.totalData.fProjectname == "" ||
							this.totalData.fProjectname == null
						) {
							this.totalData.fProjectname = this.userInfo.projectName;
							this.totalData.fProjectid = this.userInfo.projectId;
						}
						if (
							this.totalData.fCompanyid == "" ||
							this.totalData.fCompanyid == null ||
							this.totalData.fCompanyname == "" ||
							this.totalData.fCompanyname == null
						) {
							this.totalData.fCompanyname = this.userInfo.companyName;
							this.totalData.fCompanyid = this.userInfo.companyId;
						}
						// 发现问题日期
						if (
							this.totalData.fHasproblemdates == "" ||
							this.totalData.fHasproblemdates == null
						) {
							this.totalData.fHasproblemdates = this.timing;
						}
						// 填报人姓名
						if (
							this.totalData.fReportid == "" ||
							this.totalData.fReportid == null ||
							this.totalData.fReportname == "" ||
							this.totalData.fReportname == null
						) {
							this.totalData.fReportname = this.userInfo.realName;
							this.totalData.fReportid = this.userInfo.userId;
						}
						// 填报日期
						if (
							this.totalData.fReportdates == "" ||
							this.totalData.fReportdates == null
						) {
							this.totalData.fReportdates = this.timing;
						}
					} else {

						// 指定网格员
						if (
							this.totalData.fGridmanid == "" ||
							this.totalData.fGridmanid == null ||
							this.totalData.fGridmanname == "" ||
							this.totalData.fGridmanname == null
						) {
							this.totalData.fGridmanname = this.userInfo.realName;
							this.totalData.fGridmanid = this.userInfo.userId;
						}
						// 完成日期
						if (
							this.totalData.fCheckdates == "" ||
							this.totalData.fCheckdates == null
						) {
							this.totalData.fCheckdates = this.timing;
						}
					}

					// 文件
					var file = res.data.fFileurllist;
					file.map((item, index) => {
						that.fileList.push({
							fId: item.fId,
							name: item.fFileName,
							url: item.url
						})
					})
					// 处理过程相关资料
					var Recheckfile = res.data.fCheckfilelist;
					Recheckfile.map((item, index) => {
						that.fRecheckfileList.push({
							fId: item.fId,
							name: item.fFileName,
							url: item.url
						})
					})

					that.page = true


				} else {
					uni.showToast({
						title: "请求失败",
						icon: 'none',
						duration: 2000
					});
				}

			}, (err) => {
				uni.showToast({
					title: "接口报错",
					icon: 'none',
					duration: 2000
				});
			})

		},
		// 网格员类别选择  调指定网格员接口
		GridmantypeFun(e) {
			if (
				this.totalData.fGridmantype != "" &&
				this.totalData.fGridmantype != null &&
				this.totalData.fCheckprojectid != "" &&
				this.totalData.fCheckprojectid != null
			) {
				this.getGridman();
				this.totalData.fSubgridmanid = '';
				this.totalData.fSubgridmanname = '';
			} else {
				this.fSubgridmannameList = [];
				this.totalData.fSubgridmanid = '';
				this.totalData.fSubgridmanname = '';
			}
		},
		// 指定网格员选择赋值
		SubgridmanFun(e) {
			console.log("指定网格员", e);
			this.gridmanList.map(item => {
				if (item.fChargeusername == e) {
					this.totalData.fSubgridmanid = item.fChargeuserid; //指定网格员id
					this.totalData.fSubgridmanname = e; //指定网格员姓名
				}
			})
		},
		// 下拉框
		selectorFun(e) {
			console.log("下拉选择", e);

		},
		// 获取指定网格员
		getGridman() {
			this.fSubgridmannameList = [];
			var treeText = {
				fQualitygridclass: this.totalData.fGridmantype, //质量网格类别
				fCompanyid: this.totalData.fCheckprojectid, //项目id
			};
			this.$refs.loading.open();

			this.$http.getPersonLists(treeText)
				.then((res) => {
					if (res.errcode == 0) {
						this.gridmanList = res.data;
						res.data.map((item) => {
							this.fSubgridmannameList.push(item.fChargeusername);
						});
						this.$refs.loading.close();
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none',
							duration: 2000
						});
						this.$refs.loading.close();
					}
				}, (err) => {
					uni.showToast({
						title: err.msg,
						icon: 'none',
						duration: 2000
					});
					this.$refs.loading.close();
				});
		},
		// 获取指定网格员

		// 判断必填项
		saveData(data) {
			var that = this;
			if (that.totalData.fCheckunit == "" || that.totalData.fCheckunit == undefined) {
				uni.showToast({
					title: '涉及单位不能为空',
					icon: 'none',
					duration: 2000
				});
				return false;
			} else if (that.totalData.fCheckproject == "" || that.totalData.fCheckproject ==
				undefined) {
				uni.showToast({
					title: '涉及项目不能为空',
					icon: 'none',
					duration: 2000
				});
				return false;
			} else if (that.totalData.fGridmantype == "" || that.totalData.fGridmantype ==
				undefined) {
				uni.showToast({
					title: '网格员类别不能为空',
					icon: 'none',
					duration: 2000
				});
				return false;
			} else if (that.totalData.fSubgridmanname == "" || that.totalData.fSubgridmanname ==
				undefined) {
				uni.showToast({
					title: '指定网格员不能为空',
					icon: 'none',
					duration: 2000
				});
				return false;
			} else if (that.totalData.fProblemdescription == "" || that.totalData.fProblemdescription ==
				undefined) {
				uni.showToast({
					title: '存在问题简述不能为空',
					icon: 'none',
					duration: 2000
				});
				return false;
			} else {
				let totalData1 = {
					isSubmit: data,
					fId: this.totalData.fId, //传fid代表修改 不传代表新增
					fProjectname: this.userInfo.projectName, // 当前登录人项目名称
					fProjectid: this.userInfo.projectId, // 当前登录人项目ID
					fCompanyname: this.userInfo.companyName, // 当前登录人标段名称
					fCompanyid: this.userInfo.companyId, // 当前登录人标段ID
					fCheckunit: this.totalData.fCheckunit, //涉及单位
					fCheckunitid: this.totalData.fCheckunitid, //涉及单位id
					fCheckproject: this.totalData.fCheckproject, //涉及项目
					fCheckprojectid: this.totalData.fCheckprojectid, //涉及项目id
					fGridmantype: this.totalData.fGridmantype, //网格员类别
					fSubgridmanid: this.totalData.fSubgridmanid, //指定网格员id
					fSubgridmanname: this.totalData.fSubgridmanname, //指定网格员姓名
					fProblemdescription: this.totalData.fProblemdescription, //存在的问题概述
					fFileurl: this.totalData.fFileurl, //相关现场资料
					fHasproblemdates: this.totalData.fHasproblemdates, //发现问题日期
					fReportid: this.totalData.fReportid, //填报人id
					fReportname: this.totalData.fReportname, //填报人姓名
					fReportdates: this.totalData.fReportdates, //填报时间
					userId: this.userInfo.userId, //当前登录人id
					userName: this.userInfo.realName, // 当前登录人名称
					recordfiles: this.recordfiles, // 删除文件id集合
				};
				that.$refs.loading.open();
				this.$http.saveWorkonlineCommunicate(totalData1).then(res => {
					if (res.errcode == 0) {
						uni.showToast({
							title: "保存成功",
							icon: 'none',
							duration: 2000
						})
						uni.navigateTo({
							url: '/pages/apply/scene/communicate/testing/index'
						});
						this.$refs.loading.close();
					} else {
						uni.showToast({
							title: "保存失败",
							icon: 'none',
							duration: 2000
						});
						this.$refs.loading.close();
					}
				}, (err) => {
					uni.showToast({
						title: "请求失败",
						icon: 'none',
						duration: 2000
					});
					this.$refs.loading.close();
				})

			}
		},
		// 处理保存
		saveData1() {
			var that = this;
			if (that.totalData.fCheckresult == "" || that.totalData.fCheckresult == undefined) {
				uni.showToast({
					title: '处理模块-处理结果不能为空',
					icon: 'none',
					duration: 2000
				});
				return false;
			} else if (that.totalData.fCheckdescription == "" || that.totalData.fCheckdescription ==
				undefined) {
				uni.showToast({
					title: '处理模块-问题处理简述不能为空',
					icon: 'none',
					duration: 2000
				});
				return false;
			} else if (that.fRecheckfileList.length == 0) {
				uni.showToast({
					title: '处理模块-处理过程相关资料不能为空',
					icon: 'none',
					duration: 2000
				});
				return false;
			} else {
				let totalData2 = {
					fId: this.totalData.fId, //传fid代表修改 不传代表新增
					fCheckresult: this.totalData.fCheckresult, //处理结果
					fCheckfile: this.totalData.fCheckfile, //处理过程相关资料
					fCheckdescription: this.totalData.fCheckdescription, //问题处理简述
					fGridmanid: this.totalData.fGridmanid, //网格员id
					fGridmanname: this.totalData.fGridmanname, //网格员姓名
					fCheckdates: this.totalData.fCheckdates, //完成日期
					recordfiles: this.recordfiles, // 删除文件id集合
				};
				that.$refs.loading.open();
				this.$http.saveWorkonlineCommunicateByCheck(totalData2).then(res => {
					if (res.errcode == 0) {
						uni.showToast({
							title: "签收成功",
							icon: 'none',
							duration: 2000
						})
						uni.navigateTo({
							url: '/pages/apply/scene/communicate/testing/index'
						});
						this.$refs.loading.close();
					} else {
						uni.showToast({
							title: "签收失败",
							icon: 'none',
							duration: 2000
						});
						this.$refs.loading.close();
					}
				}, (err) => {
					uni.showToast({
						title: "签收接口请求失败",
						icon: 'none',
						duration: 2000
					});
					this.$refs.loading.close();
				})

			}
		},


		// 原生窗体按钮显示
		playVideo() {
			let subNVue = uni.getSubNVueById('safe_notice')
			subNVue.show()
		},

		// 获取当前日期
		getDate() {
			var time = new Date();
			const y = time.getFullYear();
			const m = (time.getMonth() + 1 + "").padStart(2, "0");
			const d = (time.getDate() + "").padStart(2, "0");
			const hh = (time.getHours() + "").padStart(2, "0");
			const mm = (time.getMinutes() + "").padStart(2, "0");
			const ss = (time.getSeconds() + "").padStart(2, "0");
			// var timer = `${y}-${m}-${d} ${hh}:${mm}:${ss}`;
			var timer = `${y}-${m}-${d} ${hh}:${mm}`;
			var timing = `${y}-${m}-${d}`;
			this.timing = `${y}-${m}-${d}`;
			this.time = `${hh}:${mm}`;
			this.lasttiming = `${y}-${m}-${d}`;
			this.lasttime = `${hh}:${mm}`;

		},
		callback() {}
	}
}
